package practice_0527;

import javax.swing.*;
import java.awt.*;

public class practice07 {
    public static void main(String[] args) {
        new SwingAndThread();
        for (int i = 0; i < 5; i++) {
            System.out.println(Thread.currentThread().getName() + "hi"+ i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

}
class SwingAndThread {
    public SwingAndThread() {
        Thread t = new Thread(){
            public void run(){
                for (int i = 0; i < 5; i++) {
                    System.out.println(Thread.currentThread().getName()+ "hello!" + i);
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }

        };
        t.start();

    }
}